/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.smarttmt.idu.web.persistence.entity;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author root
 */
@Entity
@Table(name = "USCOCHIP")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Uscochip.findAll", query = "SELECT u FROM Uscochip u"),
    @NamedQuery(name = "Uscochip.findByUcchcodi", query = "SELECT u FROM Uscochip u WHERE u.uscochipPK.ucchcodi = :ucchcodi"),
    @NamedQuery(name = "Uscochip.findByUscocodi", query = "SELECT u FROM Uscochip u WHERE u.uscochipPK.uscocodi = :uscocodi"),
    @NamedQuery(name = "Uscochip.findByUcchesta", query = "SELECT u FROM Uscochip u WHERE u.ucchesta = :ucchesta"),
    @NamedQuery(name = "Uscochip.findByUcchfecr", query = "SELECT u FROM Uscochip u WHERE u.ucchfecr = :ucchfecr"),
    @NamedQuery(name = "Uscochip.findByUcchfemo", query = "SELECT u FROM Uscochip u WHERE u.ucchfemo = :ucchfemo")})
public class Uscochip implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected UscochipPK uscochipPK;
    @Size(max = 5)
    @Column(name = "UCCHESTA")
    private String ucchesta;
    @Column(name = "UCCHFECR")
    @Temporal(TemporalType.TIMESTAMP)
    private Date ucchfecr;
    @Column(name = "UCCHFEMO")
    @Temporal(TemporalType.TIMESTAMP)
    private Date ucchfemo;
    @JoinColumn(name = "USCOCODI", referencedColumnName = "USCOCODI", insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Usuacont usuacont;

    public Uscochip() {
    }

    public Uscochip(UscochipPK uscochipPK) {
        this.uscochipPK = uscochipPK;
    }

    public Uscochip(String ucchcodi, BigInteger uscocodi) {
        this.uscochipPK = new UscochipPK(ucchcodi, uscocodi);
    }

    public UscochipPK getUscochipPK() {
        return uscochipPK;
    }

    public void setUscochipPK(UscochipPK uscochipPK) {
        this.uscochipPK = uscochipPK;
    }

    public String getUcchesta() {
        return ucchesta;
    }

    public void setUcchesta(String ucchesta) {
        this.ucchesta = ucchesta;
    }

    public Date getUcchfecr() {
        return ucchfecr;
    }

    public void setUcchfecr(Date ucchfecr) {
        this.ucchfecr = ucchfecr;
    }

    public Date getUcchfemo() {
        return ucchfemo;
    }

    public void setUcchfemo(Date ucchfemo) {
        this.ucchfemo = ucchfemo;
    }

    public Usuacont getUsuacont() {
        return usuacont;
    }

    public void setUsuacont(Usuacont usuacont) {
        this.usuacont = usuacont;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (uscochipPK != null ? uscochipPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Uscochip)) {
            return false;
        }
        Uscochip other = (Uscochip) object;
        if ((this.uscochipPK == null && other.uscochipPK != null) || (this.uscochipPK != null && !this.uscochipPK.equals(other.uscochipPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.smarttmt.idu.web.persistence.entity.Uscochip[ uscochipPK=" + uscochipPK + " ]";
    }
    
}
